// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      2025-02-08
// @description  try to take over the world!
// @author       You
// @match        https://game.ur1.fun/adarkroom/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ur1.fun
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 生火
    setInterval(() => {
        clickButtonByID("stokeButton");
    },1000);

    // 制作陷阱
    setInterval(() => {
        watchTraps();
    },1000);

    // 收集木头
    setInterval(() => {
        clickButtonByID("gatherButton");
    },1000);

    // 查看陷阱
    setInterval(() => {
        clickButtonByID("trapsButton");
    },1000);
})();

function watchTraps(){
    var traps=document.querySelector("#building_row_baited-trap .row_val");
    if(traps&&traps.innerHTML<10){
        clickButtonByID("build_trap");
    }
}

function clickButtonByID(id){
    var button = document.getElementById(id);
    if(button&&!button.getAttribute("class").includes("disable")){
        button.click();
    }
}